package com.raycloud.erp.omll.data.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.raycloud.erp.omll.data.entity.MulPlatformUser;
import com.raycloud.erp.omll.data.mapper.MulPlatformUserMapper;
import com.raycloud.erp.omll.data.service.MulPlatformUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 平台店铺信息表 服务实现类
 * </p>
 *
 * @author 枫伦
 * @since 2021-01-05
 */
@Service
public class MulPlatformUserServiceImpl extends ServiceImpl<MulPlatformUserMapper, MulPlatformUser> implements MulPlatformUserService {
    @Autowired
    private MulPlatformUserMapper mulPlatformUserMapper;

    @Override
    public int insert(MulPlatformUser mulPlatformUser) {
        return mulPlatformUserMapper.insert(mulPlatformUser);
    }

    @Override
    public List<MulPlatformUser> getAll() {
        return mulPlatformUserMapper.getAll();
    }

    @Override
    public MulPlatformUser getUserByUserIdCompanyId(MulPlatformUser mulPlatformUser) {
        QueryWrapper<MulPlatformUser> queryWrapper = new QueryWrapper();
        queryWrapper.eq("company_id", mulPlatformUser.getCompanyId());
        queryWrapper.eq("user_id", mulPlatformUser.getUserId());
        queryWrapper.eq("enable_status", true);
        return mulPlatformUserMapper.selectOne(queryWrapper);
    }
}
